package designpattern.state;

public class SoldState implements State{
	GumballMachine gumballMachine;
	
	public SoldState(GumballMachine gumballMachine) {
		this.gumballMachine = gumballMachine;
	}
	
	@Override
	public void dispense() {
		if(gumballMachine.count > 0) {
			gumballMachine.releaseGumball();
			gumballMachine.setState(gumballMachine.getNoQuarter());
		} else {
			System.out.println("The machine is out of gumballs.");
			gumballMachine.setState(gumballMachine.getSoldOut());
		}
	}

	@Override
	public void ejectQuarter() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void insertQuarter() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void turnCrank() {
		// TODO Auto-generated method stub
		
	}

}
